package util;

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import static util.HttpUploadFile.formUpload;

/**
 * Created by yijy on 2017/6/19.
 */
public class HttpUploadFacePlus {
    public static void main(String[] args) {
        testUploadImage();
    }

    /**
     * 上传文件图片
     */
    public static void testUploadImage(){
        String url = "https://api-cn.faceplusplus.com/sdk/v2/auth";
        String path = "D:\\搜狗高速下载\\身份证正面.png";
        Map<String, String> textMap = new HashMap<String, String>();
        Map<String, String> fileMap = new HashMap<String, String>();
        textMap.put("api_key", "-y7kHT9zh8ZhGTioOAiGDh_XWb9RT7Dx");
        textMap.put("api_secret", "qrWajbljdYsH-M8qgVlzB62DDg1f6mtC");
//        textMap.put("comparison_type", "1");
//        textMap.put("face_image_type", "raw_image");
//        textMap.put("idcard_name", "姓名");
//        textMap.put("idcard_number", "身份证号");
        fileMap.put("image", path);
        String contentType = "application/octet-stream";
        String ret = formUpload(url, textMap, fileMap,contentType);
        System.out.println(ret);
    }


}
